/*
 * This file (AxObject.java) is protected by the GNU GPL licence (v2). 
 * Please read the license.txt attached for further informations. 
 * 
 */

package artx.objects;

import java.util.Locale;

/**
 * Standard basic object.
 * 
 * @author Xavier Gouchet
 * 
 */
public abstract class AxObject {

	/** Unique ID (int) is the unique number identifying a child class. */
	protected int UID;

	/** Name of the class */
	protected String NAME;

	/**
	 * Standard Constructor.
	 * 
	 * @param id
	 *            the object's id
	 * @param name
	 *            the object's name
	 */
	public AxObject(int id, String name) {
		this.UID = (int) id;
		if ((name != null) && (!name.isEmpty())) {
			this.NAME = new String(name.toLowerCase(Locale.ENGLISH));
		} else {
			this.NAME = "";
		}
	}

	/**
	 * 
	 * @return the object's Unique ID
	 */
	public final int GetUID() {
		return (int) this.UID;
	}

	/**
	 * 
	 * @return the object's name
	 */
	public final String GetName() {
		return new String(this.NAME);
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return "\"" + this.NAME + "\" (#" + this.UID + ")";
	}
}
